/**
 * 日期：2025/7/15
 */

/**
 * 鼠标按钮类型
 */
export enum ParsecMouseButton {
  /**
   * 鼠标左键
   */
  MOUSE_L = 1,
  /**
   * 鼠标中键
   */
  MOUSE_MIDDLE = 2,
  /**
   * 鼠标右键
   */
  MOUSE_R = 3,
  /**
   * 额外的鼠标按钮 1
   */
  MOUSE_X1 = 4,
  /**
   * 额外的鼠标按钮 2
   */
  MOUSE_X2 = 5
}


/**
 * @brief 输入消息类型枚举
 * @description 表示ParsecMessage中的消息类型
 */
export enum ParsecMessageType {
  /**
   * 键盘消息
   */
  MESSAGE_KEYBOARD = 1,

  /**
   * 鼠标按钮消息
   */
  MESSAGE_MOUSE_BUTTON = 2,

  /**
   * 鼠标滚轮消息
   */
  MESSAGE_MOUSE_WHEEL = 3,

  /**
   * 鼠标移动消息
   */
  MESSAGE_MOUSE_MOTION = 4,

  /**
   * 游戏手柄按钮消息
   */
  MESSAGE_GAMEPAD_BUTTON = 5,

  /**
   * 游戏手柄轴消息
   */
  MESSAGE_GAMEPAD_AXIS = 6,

  /**
   * 游戏手柄拔出消息
   */
  MESSAGE_GAMEPAD_UNPLUG = 7,

  /**
   * 游戏手柄状态消息
   */
  MESSAGE_GAMEPAD_STATE = 8,

  /**
   * 指示主机释放当前所有按下的输入的消息
   */
  MESSAGE_RELEASE = 9
}

/**
 * 远程状态
 */
export enum ParsecStatus {
  PARSEC_OK = 0, ///< 0
  HOST_WRN_SHUTDOWN = 4, ///< 4
  HOST_WRN_KICKED = 5, ///< 5
  CONNECT_WRN_APPROVAL = 6, ///< 6
  CONNECT_WRN_DECLINED = 8, ///< 8
  CONNECT_WRN_CANCELED = 9, ///< 9
  CONNECT_WRN_NO_ROOM = 11, ///< 11
  CONNECT_WRN_PEER_GONE = 99, ///< 99
  CONNECT_WRN_UNCONFIRMED = 100, ///< 100
  CONNECT_WRN_NO_PERMISSION = 112, ///< 112
  WRN_CONTINUE = 10, ///< 10
  PARSEC_CONNECTING = 20, ///< 20
  PARSEC_WRN_BROWSER = 30, ///< 30
  ALINK_WRN_INVALID = 200, ///< 200
  ALINK_WRN_INACTIVE = 201, ///< 201
  ALINK_WRN_EXPIRED = 202, ///< 202
  ALINK_WRN_NOT_STARTED = 203, ///< 203
  ALINK_WRN_TEAM_INVALID = 204, ///< 204
  DECODE_WRN_CONTINUE = 1000, ///< 1000
  DECODE_WRN_ACCEPTED = 1001, ///< 1001
  DECODE_WRN_REINIT = 1003, ///< 1003
  NETWORK_WRN_TIMEOUT = 2000, ///< 2000
  AUDIO_WRN_NO_DATA = 6000, ///< 6000
  ERR_DEFAULT = -1, ///< -1
  PARSEC_NOT_RUNNING = -3, ///< -3
  PARSEC_ALREADY_RUNNING = -4, ///< -4
  PARSEC_NOT_IMPLEMENTED = -5, ///< -5
  PARSEC_ERR_PRE_RENDER = -6, ///< -6
  DECODE_ERR_INIT = -10, ///< -10
  DECODE_ERR_LOAD = -11, ///< -11
  DECODE_ERR_MAP = -13, ///< -13
  DECODE_ERR_DECODE = -14, ///< -14
  DECODE_ERR_CLEANUP = -15, ///< -15
  DECODE_ERR_PARSE = -16, ///< -16
  DECODE_ERR_NO_SUPPORT = -17, ///< -17
  DECODE_ERR_PIXEL_FORMAT = -18, ///< -18
  DECODE_ERR_BUFFER = -19, ///< -19
  DECODE_ERR_RESOLUTION = -20, ///< -20
  DECODE_ERR_OUT_OF_RANGE = -21, ///< -21
  DECODE_ERR_DEPENDENCY = -22, ///< -22
  DECODE_ERR_SYMBOL = -23, ///< -23
  WS_ERR_READ = -3002, ///< -3002
  WS_ERR_WRITE = -3003, ///< -3003
  WS_ERR_AUTH = -3008, ///< -3008
  WS_ERR_GOING_AWAY = -3009, ///< -3009
  WS_ERR_TEAM_DEACTIVATED = -3010, ///< -3010
  WS_ERR_CONNECT = -6101, ///< -6101
  WS_ERR_CLOSE = -6105, ///< -6105
  WS_ERR_INVALID_MSG = -6106, ///< -6106
  NAT_ERR_PEER_PHASE = -6023, ///< -6023
  NAT_ERR_STUN_PHASE = -6024, ///< -6024
  NAT_ERR_INTEGRITY = -6025, ///< -6025
  NAT_ERR_NO_CANDIDATES = -6033, ///< -6033
  NAT_ERR_JSON_ACTION = -6111, ///< -6111
  NAT_ERR_NO_SOCKET = -6112, ///< -6112
  NAT_ERR_WEBRTC = -6200, ///< -6200
  OPENGL_ERR_CONTEXT = -7000, ///< -7000
  OPENGL_ERR_SHARE = -7001, ///< -7001
  OPENGL_ERR_PIXFORMAT = -7002, ///< -7002
  OPENGL_ERR_CURRENT = -7003, ///< -7003
  OPENGL_ERR_DC = -7004, ///< -7004
  OPENGL_ERR_SHADER = -7005, ///< -7005
  OPENGL_ERR_PROGRAM = -7006, ///< -7006
  OPENGL_ERR_VERSION = -7007, ///< -7007
  OPENGL_ERR_TEXTURE = -7008, ///< -7008
  JSON_ERR_PARSE = -8000, ///< -8000
  AUDIO_ERR_CAPTURE_INIT = -9000, ///< -9000
  AUDIO_ERR_CAPTURE = -9001, ///< -9001
  AUDIO_ERR_NETWORK = -9002, ///< -9002
  AUDIO_ERR_FREE = -9003, ///< -9003
  AUDIO_OPUS_ERR_INIT = -10000, ///< -10000
  AUDIO_OPUS_ERR_DECODE = -10001, ///< -10001
  AUDIO_OPUS_ERR_ENCODE = -10002, ///< -10002
  NETWORK_ERR_BG_TIMEOUT = -12007, ///< -12007
  NETWORK_ERR_BAD_PACKET = -12008, ///< -12008
  NETWORK_ERR_BUFFER = -12011, ///< -12011
  NETWORK_ERR_SHUTDOWN = -12017, ///< -12017
  NETWORK_ERR_UNSUPPORTED = -12018, ///< -12018
  NETWORK_ERR_INTERRUPTED = -12019, ///< -12019
  SERVER_ERR_DISPLAY = -13000, ///< -13000
  SERVER_ERR_RESOLUTION = -13008, ///< -13008
  SERVER_ERR_MAX_RESOLUTION = -13009, ///< -13009
  SERVER_ERR_NO_USER = -13011, ///< -13011
  SERVER_ERR_VIDEO_DONE = -13013, ///< -13013
  SERVER_ERR_CLIENT_ABORT = -13014, ///< -13014
  SERVER_ERR_CLIENT_GONE = -13015, ///< -13015
  CAPTURE_ERR_INIT = -14003, ///< -14003
  CAPTURE_ERR_TEXTURE = -14004, ///< -14004
  CAPTURE_ERR_INVALID = -14005, ///< -14005
  ENCODE_ERR_INIT = -15000, ///< -15000
  ENCODE_ERR_ENCODE = -15002, ///< -15002
  ENCODE_ERR_BUFFER = -15006, ///< -15006
  ENCODE_ERR_PROPERTIES = -15100, ///< -15100
  ENCODE_ERR_LIBRARY = -15101, ///< -15101
  ENCODE_ERR_SESSION = -15007, ///< -15007
  ENCODE_ERR_SESSION1 = -15103, ///< -15103
  ENCODE_ERR_SESSION2 = -15104, ///< -15104
  ENCODE_ERR_OUTPUT_INIT = -15105, ///< -15105
  ENCODE_ERR_TEXTURE = -15106, ///< -15106
  ENCODE_ERR_OUTPUT = -15107, ///< -15107
  ENCODE_ERR_UNSUPPORTED = -15108, ///< -15108
  ENCODE_ERR_HANDLE = -15109, ///< -15109
  ENCODE_ERR_CAPS = -15110, ///< -15110
  UPNP_ERR = -19000, ///< -19000
  D3D_ERR_TEXTURE = -22000, ///< -22000
  D3D_ERR_SHADER = -22001, ///< -22001
  D3D_ERR_BUFFER = -22002, ///< -22002
  D3D_ERR_LAYOUT = -22003, ///< -22003
  D3D_ERR_DEVICE = -22004, ///< -22004
  D3D_ERR_MT = -22005, ///< -22005
  D3D_ERR_ADAPTER = -22006, ///< -22006
  D3D_ERR_FACTORY = -22007, ///< -22007
  D3D_ERR_OUTPUT = -22008, ///< -22008
  D3D_ERR_CONTEXT = -22009, ///< -22009
  D3D_ERR_OUTPUT1 = -22010, ///< -22010
  D3D_ERR_SWAP_CHAIN = -22011,
  D3D_ERR_DRAW = -22012,
  D3D_ERR_OUTPUT5 = -22013,
  H26X_ERR_NOT_FOUND = -23000,
  AES_GCM_ERR_KEY_LEN = -28000,
  AES_GCM_ERR_BUFFER = -28004,
  SCTP_ERR_GLOBAL_INIT = -32000,
  SCTP_ERR_WRITE = -32001,
  SCTP_ERR_SOCKET = -32002,
  SCTP_ERR_BIND = -32003,
  SCTP_ERR_CONNECT = -32004,
  STUN_ERR_PACKET = -34000,
  STUN_ERR_PARSE_HEADER = -34001,
  STUN_ERR_PARSE_ADDRESS = -34002,
  SO_ERR_OPEN = -35000,
  SO_ERR_SYMBOL = -35001,
  PARSEC_ERR_VERSION = -36000,
  PARSEC_ERR_VER_DATA = -36001,
  RESAMPLE_ERR_INIT = -37000,
  RESAMPLE_ERR_RESAMPLE = -37001,
  UNITY_UNSUPPORTED_ENGINE = -38000,
  METAL_ERR_INIT = -39000,
  METAL_ERR_PIXEL_FORMAT = -39001,
  RPI_ERR_MEM_SPLIT = -40000,
  OPENSSL_ERR = -600000,
  SOCKET_ERR1 = -700000,
  SOCKET_ERR2 = -800000,
}

/**
 * 键盘按键
 */
export enum ParsecKeycode {
  KEY_A = 4, ///< 4
  KEY_B = 5, ///< 5
  KEY_C = 6, ///< 6
  KEY_D = 7, ///< 7
  KEY_E = 8, ///< 8
  KEY_F = 9, ///< 9
  KEY_G = 10, ///< 10
  KEY_H = 11, ///< 11
  KEY_I = 12, ///< 12
  KEY_J = 13, ///< 13
  KEY_K = 14, ///< 14
  KEY_L = 15, ///< 15
  KEY_M = 16, ///< 16
  KEY_N = 17, ///< 17
  KEY_O = 18, ///< 18
  KEY_P = 19, ///< 19
  KEY_Q = 20, ///< 20
  KEY_R = 21, ///< 21
  KEY_S = 22, ///< 22
  KEY_T = 23, ///< 23
  KEY_U = 24, ///< 24
  KEY_V = 25, ///< 25
  KEY_W = 26, ///< 26
  KEY_X = 27, ///< 27
  KEY_Y = 28, ///< 28
  KEY_Z = 29, ///< 29
  KEY_1 = 30, ///< 30
  KEY_2 = 31, ///< 31
  KEY_3 = 32, ///< 32
  KEY_4 = 33, ///< 33
  KEY_5 = 34, ///< 34
  KEY_6 = 35, ///< 35
  KEY_7 = 36, ///< 36
  KEY_8 = 37, ///< 37
  KEY_9 = 38, ///< 38
  KEY_0 = 39, ///< 39
  KEY_ENTER = 40, ///< 40
  KEY_ESCAPE = 41, ///< 41
  KEY_BACKSPACE = 42, ///< 42
  KEY_TAB = 43, ///< 43
  KEY_SPACE = 44, ///< 44
  KEY_MINUS = 45, ///< 45
  KEY_EQUALS = 46, ///< 46
  KEY_LBRACKET = 47, ///< 47
  KEY_RBRACKET = 48, ///< 48
  KEY_BACKSLASH = 49, ///< 49
  KEY_SEMICOLON = 51, ///< 51
  KEY_APOSTROPHE = 52, ///< 52
  KEY_BACKTICK = 53, ///< 53
  KEY_COMMA = 54, ///< 54
  KEY_PERIOD = 55, ///< 55
  KEY_SLASH = 56, ///< 56
  KEY_CAPSLOCK = 57, ///< 57
  KEY_F1 = 58, ///< 58
  KEY_F2 = 59, ///< 59
  KEY_F3 = 60, ///< 60
  KEY_F4 = 61, ///< 61
  KEY_F5 = 62, ///< 62
  KEY_F6 = 63, ///< 63
  KEY_F7 = 64, ///< 64
  KEY_F8 = 65, ///< 65
  KEY_F9 = 66, ///< 66
  KEY_F10 = 67, ///< 67
  KEY_F11 = 68, ///< 68
  KEY_F12 = 69, ///< 69
  KEY_PRINTSCREEN = 70, ///< 70
  KEY_SCROLLLOCK = 71, ///< 71
  KEY_PAUSE = 72, ///< 72
  KEY_INSERT = 73, ///< 73
  KEY_HOME = 74, ///< 74
  KEY_PAGEUP = 75, ///< 75
  KEY_DELETE = 76, ///< 76
  KEY_END = 77, ///< 77
  KEY_PAGEDOWN = 78, ///< 78
  KEY_RIGHT = 79, ///< 79
  KEY_LEFT = 80, ///< 80
  KEY_DOWN = 81, ///< 81
  KEY_UP = 82, ///< 82
  KEY_NUMLOCK = 83, ///< 83
  KEY_KP_DIVIDE = 84, ///< 84
  KEY_KP_MULTIPLY = 85, ///< 85
  KEY_KP_MINUS = 86, ///< 86
  KEY_KP_PLUS = 87, ///< 87
  KEY_KP_ENTER = 88, ///< 88
  KEY_KP_1 = 89, ///< 89
  KEY_KP_2 = 90, ///< 90
  KEY_KP_3 = 91, ///< 91
  KEY_KP_4 = 92, ///< 92
  KEY_KP_5 = 93, ///< 93
  KEY_KP_6 = 94, ///< 94
  KEY_KP_7 = 95, ///< 95
  KEY_KP_8 = 96, ///< 96
  KEY_KP_9 = 97, ///< 97
  KEY_KP_0 = 98, ///< 98
  KEY_KP_PERIOD = 99, ///< 99
  KEY_APPLICATION = 101, ///< 101
  KEY_F13 = 104, ///< 104
  KEY_F14 = 105, ///< 105
  KEY_F15 = 106, ///< 106
  KEY_F16 = 107, ///< 107
  KEY_F17 = 108, ///< 108
  KEY_F18 = 109, ///< 109
  KEY_F19 = 110, ///< 110
  KEY_MENU = 118, ///< 118
  KEY_MUTE = 127, ///< 127
  KEY_VOLUMEUP = 128, ///< 128
  KEY_VOLUMEDOWN = 129, ///< 129
  KEY_LCTRL = 224, ///< 224
  KEY_LSHIFT = 225, ///< 225
  KEY_LALT = 226, ///< 226
  KEY_LGUI = 227, ///< 227
  KEY_RCTRL = 228, ///< 228
  KEY_RSHIFT = 229, ///< 229
  KEY_RALT = 230, ///< 230
  KEY_RGUI = 231, ///< 231
  KEY_AUDIONEXT = 258, ///< 258
  KEY_AUDIOPREV = 259, ///< 259
  KEY_AUDIOSTOP = 260, ///< 260
  KEY_AUDIOPLAY = 261, ///< 261
  KEY_AUDIOMUTE = 262, ///< 262
  KEY_MEDIASELECT = 263, ///< 263
}

/**
 * 按键激活态
 */
export enum ParsecKeymod {
  MOD_NONE = 0x0000, ///< 没有激活的修饰键。
  MOD_LSHIFT = 0x0001, ///< `左 SHIFT` 键当前处于激活状态。
  MOD_RSHIFT = 0x0002, ///< `右 SHIFT` 键当前处于激活状态。
  MOD_LCTRL = 0x0040, ///< `左 CONTROL` 键当前处于激活状态。
  MOD_RCTRL = 0x0080, ///< `右 CONTROL` 键当前处于激活状态。
  MOD_LALT = 0x0100, ///< `左 ALT` 键当前处于激活状态。
  MOD_RALT = 0x0200, ///< `右 ALT` 键当前处于激活状态。
  MOD_LGUI = 0x0400, ///< `左 GUI` 键当前处于激活状态。这是 Windows 键 / 左 Command 键。
  MOD_RGUI = 0x0800, ///< `右 GUI` 键当前处于激活状态。这是右 Command 键。
  MOD_NUM = 0x1000, ///< `NUMLOCK` 键当前处于激活状态。
  MOD_CAPS = 0x2000, ///< `CAPSLOCK` 键当前处于激活状态。
}

export enum ParsecClientEventType {
  CLIENT_EVENT_CURSOR = 1, ///< 光标模式发生变化或光标图像已更新，`cursor` 在 ::ParsecClientEvent 中有效。若图像更新，请调用 ::ParsecGetBuffer。
  CLIENT_EVENT_RUMBLE = 2, ///< 游戏手柄震动事件，`rumble` 在 ::ParsecClientEvent 中有效。
  CLIENT_EVENT_USER_DATA = 3, ///< 来自主机的用户自定义消息，`userData` 在 ::ParsecClientEvent 中有效。
  CLIENT_EVENT_BLOCKED = 4, ///< 客户端已被临时阻止发送输入和接收主机输出。
  CLIENT_EVENT_UNBLOCKED = 5, ///< 客户端在收到 ::CLIENT_EVENT_BLOCKED 事件后已恢复正常运行。
  CLIENT_EVENT_STREAM = 6, ///< 视频流状态已更改，可能表示出现故障。`stream` 在 ::ParsecClientEvent 中有效。
}